/*
 * @Author: chen haoxuan
 * @Date: 2021-06-04 22:45:32
 * @LastEditTime: 2021-06-04 22:56:31
 */
// 5.51 简单派生类的构造函数
#include<iostream>
#include<string>
using namespace std;
class Student
{
  public:
    Student(int n,string nam,char s)
    {
      num=n;
      name=nam;
      sex=s;
    }
    ~Student(){}
  protected:
    int num;
    string name;
    char sex;
};
class Student1:public Student
{
  public:
    Student1(int n,string nam,char s,int a,string ad):Student(n,nam,s)
    {
      age=a;
      addr=ad;
    }
    void show()
    {
      cout<<"num: "<<num<<endl;
      cout<<"name: "<<name<<endl;
      cout<<"sex: "<<sex<<endl;
      cout<<"age: "<<age<<endl;
      cout<<"address: "<<addr<<endl;
      
    }
    ~Student1(){}
  private:
    int age;
    string addr;
};
int main()
{
  Student1 stud1(10010,"wang-li",'f',19,"115 beijing");
  Student1 stud2(10011,"Zhang-fan",'m',21,"213 shanghai");
  stud1.show();
  stud2.show();
  system("pause");
  return 0;
}
/*
  构造函数执行顺序：
    1.执行基类的构造函数
    2.执行派生类的构造函数
*/